# with open('data.txt','r') as file:
#     data = file.read()
#     print(data)


# with open('data.txt','r') as file:
#     data = file.readlines()
#     print(data)


# 二进制文件一般情况下回进行编码
# with open('image.png','rb') as image:
#     data = image.read()
#     print(data)


# with open("write.txt",'wb') as write:
#     write.write(b"xxxxxxx")
#     # TypeError: a bytes-like object is required, not 'str'
#     print(write)
#
# with open("write.txt",'r') as read:
#     data = read.read()
#     print(data)

with open(r'image.png','rb') as  image:
    image_data = image.read()
    with open(r'image_w.png','wb') as image_w:
        image_w.write(image_data)
